package com.gp.controller;

import com.gp.entity.MaintainShop;
import com.gp.service.MaintainShopService;
import com.gp.util.CommonResult;
import com.gp.vo.MaintainShopVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName ShopController
 * @Description //TODO
 * @Author luzzh
 * @Date 2022/3/8 20:28
 */
@CrossOrigin
@RestController
@RequestMapping("maintain/shop")
public class MaintainShopController {
    @Autowired
    private MaintainShopService maintainShopService;
    @GetMapping("getById")
    public CommonResult getById(Integer id){
        return maintainShopService.selectById(id);
    }
    @GetMapping("getAllMaintain/{}")
    public CommonResult getAllMaintain(){
        return maintainShopService.findAllMaintain();
    }
    @PostMapping("addMaintain")
    public CommonResult addMaintain(@RequestBody MaintainShop maintainShop){
        return maintainShopService.addMaintain(maintainShop);
    }
    @PutMapping("updateMaintain")
    public CommonResult updateMaintain(@RequestBody MaintainShop maintainShop){
        return maintainShopService.updateMaintain(maintainShop);
    }
    @DeleteMapping("deleteMaintain")
    public CommonResult deleteMaintain(Integer id){
        return maintainShopService.deleteMaintain(id);
    }
    @PostMapping("/getAll/{currentPage}/{pageSize}")
    @ApiOperation(value = "查询所有分页")
    public CommonResult getAll(
            @PathVariable Integer currentPage,
            @PathVariable Integer pageSize,
            @RequestBody MaintainShopVo shopVo
    ){
        return maintainShopService.selectByPage(currentPage,pageSize,shopVo);
    }
}
